
package com.studiofortress.sf.util.collections;

/**
 * This extends the CallbackIterator with a means to be able to stop iterating.
 * During the iterate method you can call stopIteration() and then this iterator
 * will no longer be used in iteration.
 *
 * The iterator can be re-used later by calling the startIteration method.
 *
 * @author Joseph Lenton - JosephLenton@StudioFortress.com
 */
public abstract class CallbackPartialIterator<T> implements CallbackIterator<T>
{
    private boolean isRunning;

    public CallbackPartialIterator()
    {
        isRunning = true;
    }

    public boolean isIterating()
    {
        return isRunning;
    }

    public void startIteration()
    {
        isRunning = true;
    }

    public void stopIteration()
    {
        isRunning = false;
    }
}
